<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改电子名片业务填报类型配置')"/>
    <th:block th:include="include :: datetimepicker-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-config-edit" th:object="${ecardBusiReportConfig}">
        <input name="id" th:field="*{id}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">独立法人 ：</label>
            <div class="col-sm-8">
                <select name="deptId" id="deptId" class="selectpicker form-control m-b"
                        th:with="type=${@dept.selectDeptListByType('2')}" required>
                    <option value="">请选择</option>
                    <option th:each="dept : ${type}" th:text="${dept.deptName}"
                            th:value="${dept.deptId}" th:field="*{deptId}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">业务名称：</label>
            <div class="col-sm-8">
                <input name="busiName" th:field="*{busiName}" class="form-control"
                       type="text" required>
            </div>
        </div><div class="form-group">
            <label class="col-sm-3 control-label is-required">业务唯一标识：</label>
            <div class="col-sm-8">
                <input name="busiCode" th:field="*{busiCode}" class="form-control"
                       type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">业务填报分类：</label>
            <div class="col-sm-8">
                <select name="busiType" class="selectpicker form-control m-b"
                        th:with="type=${@dict.getType('ecard_business_reporting_sort')}" required>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                            th:value="${dict.dictValue}" th:field="*{busiType}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">是否多类积分：</label>
            <div class="col-sm-8">
                <select id="isDpsOrLoan" name="isDpsOrLoan" onchange="isDpsOrLoanChange()" class="selectpicker form-control m-b"
                        th:with="type=${@dict.getType('common_yes_no')}" required>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                            th:value="${dict.dictValue}" th:field="*{isDpsOrLoan}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">积分方式：</label>
            <div class="col-sm-8">
                <select name="integrationWay" class="selectpicker form-control m-b"
                        th:with="type=${@dict.getType('ecard_business_integral_way')}" required>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                            th:value="${dict.dictValue}" th:field="*{integrationWay}"></option>
                </select>
            </div>
        </div>
        <div class="form-group" id="integrationNumsDiv">
            <label class="col-sm-3 control-label is-required">积分/比例：</label>
            <div class="col-sm-8">
                <input name="integrationNums" th:field="*{integrationNums}" class="form-control"
                       type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">状态：</label>
            <div class="col-sm-8">
                <select name="state" class="selectpicker form-control m-b"
                        th:with="type=${@dict.getType('sys_sts')}" required>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                            th:value="${dict.dictValue}" th:field="*{state}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">是否重复勾选：</label>
            <div class="col-sm-8">
                <select name="isMore" class="selectpicker form-control m-b"
                        th:with="type=${@dict.getType('common_yes_no')}" required>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                            th:value="${dict.dictValue}" th:field="*{isMore}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注说明：</label>
            <div class="col-sm-8">
                <input name="remark" th:field="*{remark}" class="form-control"
                       type="text">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript">
    var prefix = ctx + "ecard/config/busiReportConfig";
    $("#form-config-edit").validate({
        focusCleanup: true
    });
    $(function () {
        isDpsOrLoanChange();
    })
    function isDpsOrLoanChange() {
        var isDpsOrLoan = $("#isDpsOrLoan").val();
        if (isDpsOrLoan == 'T') {
            $("#integrationNumsDiv").hide();
        } else {
            $("#integrationNumsDiv").show();
        }
    }

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-config-edit').serialize());
        }
    }
</script>
</body>
</html>